package day10;

public class D10_2Demon {
    public static void main(String[] args) {
        Cat cat=new Cat("黑色",4);
        cat.eat();
        cat.CatchMouse();
        Dog dog=new Dog("黄色",4);
        dog.eat();
        dog.KeepHome();
    }
}
class Animal{
    private String color;
    private int legs;
    public Animal(){

    }
    public Animal(String color,int legs){
        this.color=color;
        this.legs=legs;
    }
    public void eat(){
        System.out.println("吃饭");
    }
}
class Cat extends Animal{
    public Cat(){
        super();
    }

    @Override
    public void eat() {
        super.eat();
    }

    public Cat(String color, int legs) {
        super(color, legs);
    }
    public void CatchMouse(){
        System.out.println("抓老鼠....");
    }
}
class Dog extends Animal{
    public Dog(String color, int legs) {
        super(color, legs);
    }
    public void KeepHome(){
        System.out.println("看家....");
    }

    @Override
    public void eat() {
        super.eat();
    }
}
